{extend name="public/base"/}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
{/block}
{block name="body"}
<div class="main-box clearfix">
    <header class="main-box-header clearfix">
        <div class="pull-left">
            <h2>{$meta_title}</h2>
        </div>
        <div class="pull-right">
            <!--<a class="btn btn-primary" href="{:url('')}">新 增</a>-->
            <!--<button class="btn btn-danger ajax-post confirm" url="{:url('')}" target-form="ids">删 除</button>-->
            <button class="btn btn-primary ajax-post confirm" id="batchAudit" data-url="{:url('rebate')}">批量审核通过
            </button>
        </div>
    </header>
    <div class="main-box-body clearfix">
        <div class="table-responsive clearfix">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th width="30"><input class="checkbox check-all" type="checkbox"></th>
                    <th width="60">ID</th>

                    <th>来自购买人</th>
                    <th>返佣接收人</th>

                    <th>投资ID</th>
                    <th>投资本金</th>
                    <th>投资时间</th>
                    <th>返佣金额</th>
                    <th>返佣状态</th>
                    <th>添加时间</th>

                    <!--<th>操作</th>-->
                </tr>
                </thead>
                <tbody>

                {volist name="list" id="item"}
                <tr>
                    <td>
                        {if $item['status'] == 2}
                        <input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}">
                        {/if}
                    </td>
                    <td>{$item['id']}</td>

                    <td>{$item['from_uid']}</td>
                    <td>{$item['to_uid']}</td>

                    <td>{$item['invest_id']}</td>
                    <td>{$item['invest_capital']}</td>
                    <td>{$item['invest_time']}</td>
                    <td>{$item['rebate_money']}</td>
                    <td>{$item['status_name']}</td>
                    <td>{$item['create_time']}</td>


                    <!--<td></td>-->
                </tr>
                {/volist}
                </tbody>
            </table>
            {$page}
        </div>
    </div>
</div>
{/block}

{block name="script"}
<!--<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>-->
<script type="text/javascript">
    $(function () {

        //点击提交审核
        $('#batchAudit').click(function () {

            var url = $(this).attr('data-url');

            var ids = $('.ids:checked');
            var param = '';

            if (ids.length > 0) {
                var str = [];//new Array();
                ids.each(function () {
                    str.push($(this).val());
                });
                param = str.join(',');
            } else {
                alert('您没有选择返佣项目？');
                return false;
            }

            if (url != undefined && url != '') {

                $.post(url, {ids: param}, function (data) {
                    if (data.code) {
                        alert(data.msg);
                        window.location.reload(true);
                        return false;
                    } else {
                        alert(data.msg);
                        return false;
                    }
                }, 'json');

                return false;
            }

            alert('URL地址为空！');
            return false;
        });

        // $.fn.editable.defaults.mode = 'popup';
        // $.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
        //     '<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
        // $('.editable').editable();

    });
</script>
{/block}
